1. Field
The present embodiments relate to code optimizations that increase the performance of application software. More specifically, the present embodiments relate to techniques for dynamically optimizing code to increase the aggregate throughput of a multi-threaded application in a highly concurrent environment.
2. Related Art
Typical just-in-time (JIT) compilers, as might be found in a modern Java™ Virtual Machine, or JVM™ (Java™ and JVM™ are trademarks of Sun Microsystems, Inc.) or other managed runtime environments, optimize emitted code only for single-threaded execution, even though the emitted code might ultimately execute in a highly concurrent environment. Most optimization strategies focus on improving the latency of individual threads and the size of code. In fact, traditional static compilers and JIT compilers are typically thread-oblivious and compile code with the singular goal of shortening the path length, that is, the path executed by a single thread. For example, JIT compilers apply feedback-directed optimization which involves: compiling the code to apply well-known static optimization techniques; profiling subsequent execution of the code to identify “hot” paths where optimization can be most profitably applied; and recompiling the code to minimize the length of the hot paths.
In modern multi-threaded environments, however, threads often work cooperatively toward providing a higher collective or aggregate throughput for an application as a whole. Optimizing in the small for “thread local” common path latency, however, is often (but not always) the best approach for a concurrent system composed of multiple cooperating threads. As the industry continues to move toward multi-core computing, optimizing for throughput will become increasingly important.
Hence, what are needed are techniques for directing a compiler to augment traditional code emission with thread-aware policies and optimization strategies to increase the aggregate throughput of multi-threaded applications.